﻿using System;
using System.Windows.Forms;
using LoLHQ.Properties;

namespace LoLHQ
{
    public partial class OptionsForm : Form
    {
        private MainForm mainForm;

        public OptionsForm(MainForm mainForm)
        {
            InitializeComponent();
            this.mainForm = mainForm;

            lolPath.Text = Settings.Default.LoLPath;
            checkForUpdatesBox.Checked = Settings.Default.CheckForUpdates;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                lolPath.Text = folderBrowserDialog.SelectedPath;
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void saveButton_Click(object sender, EventArgs e)
        {
            Settings.Default.LoLPath = lolPath.Text;
            Settings.Default.CheckForUpdates = checkForUpdatesBox.Checked;

            Settings.Default.Save();
            mainForm.LoadData();
            Close();
        }
    }
}
